import collections
class Solution(object):
    def longestPalindrome(self, s):
        """
        :type s: str
        :rtype: int
        """
        c = collections.Counter(s)
        dan_num = 0
        total_num = 0
        for key in c:
            total_num += 2 * (c[key] // 2)
            dan_num += c[key] % 2
        return total_num + min(dan_num, 1)


data = Solution()
s = "abccccdd"
print(data.longestPalindrome(s))
